<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<AlbumData>" %>

<asp:Content ID="t" ContentPlaceHolderID="TitleContent" runat="server">Album: <%= Model.Album.Name %>
</asp:Content>

<asp:Content ID="c" ContentPlaceHolderID="MainContent" runat="server">

    <h2><%= Model.Album.Name %></h2>
    <p>
        by <%= Html.ActionLink(Model.Album.From.Name, "detail", "profile", new { id = Model.Album.From.Id }, null) %>
    </p>
    
    <div class="section">
        <h3>Upload</h3>
        <div class="content">
            <% using (Html.BeginForm("upload", "photos", FormMethod.Post, new { enctype = "multipart/form-data" })) { %>
            <%= Html.Hidden("albumId", Model.Album.Id) %>
            <label for="photo">Select a photo to add:</label>
            <input type="file" id="photo" name="photo" />
            <input type="submit" value="Upload" />
            <% } %>
        </div>
    </div>
    
    <div class="section">
        <h3>Photos</h3>
        <div class="content">
            <ul id="photos">
                <% foreach (var photo in Model.Photos) { %>
                <li>
                    <a href="<%= Url.Action("photo", new { id = photo.Id }) %>">
                        <img src="<%= photo.Picture %>" alt="<%= photo.Name %>" />
                        <span><%= photo.Name %></span>
                    </a>
                    <p>                
                        <% if (((FBGraph.Demos.AspNetMvc.Controllers.BaseController)this.ViewContext.Controller).CreatedIds.Contains(photo.Id.ToString())) { %>
                        [<%= Html.ActionLink("Delete", "delete", new { id = photo.Id }, new { onclick = "return confirm('This will really delete the photo. Are you sure?');" })%>]
                        <% } %>
                    </p>
                </li>
                <% } %>
            </ul>
            <br class="clear" />
        </div>
    </div>

</asp:Content>
